GetDictionaryConverter Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to a supplied default value.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static Converter<TKey, TValue> GetDictionaryConverter<TKey, TValue>(
	IDictionary<TKey, TValue> dictionary,
	TValue defaultValue
)
Visual Basic (Declaration)
Public Shared Function GetDictionaryConverter(Of TKey, TValue) ( _
	dictionary As IDictionary(Of TKey, TValue), _
	defaultValue As TValue _
) As Converter(Of TKey, TValue)
Visual C++
public:
generic<typename TKey, typename TValue>
static Converter<TKey, TValue>^ GetDictionaryConverter (
	IDictionary<TKey, TValue>^ dictionary, 
	TValue defaultValue
)

Parameters

dictionary
IDictionary<(Of <TKey, TValue>)>
The dictionary used to perform the conversion.
defaultValue
TValue
The result of the conversion for keys that are not present in the dictionary.

Return Value

A delegate to a method that converts keys to values.

Type Parameters

TKey
TValue

Remarks

This delegate can be used as a parameter in Convert or ConvertAll methods to convert entire collections.

Exceptions

ExceptionCondition
System..::ArgumentNullExceptiondictionary is null.

See Also